package com.gim.sap.main;

import com.gim.sap.R;
import com.gim.sap.battery.BatteryMainActivity;
import com.gim.sap.dialog.DialogMainActivity;
import com.gim.sap.sim.SIMMainActivity;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageButton;


public class MainActivity extends Activity {
	private ImageButton batteryButton;
	private ImageButton safelockBtn;
	private ImageButton simBtn;
	private Context context = this;
	private Intent intent;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		intialControl();
	}

	private void intialControl() {
		batteryButton = (ImageButton) findViewById(R.id.batteryManage);
		safelockBtn=(ImageButton) findViewById(R.id.safelockBtn);
		simBtn=(ImageButton)findViewById(R.id.btnSim);
		clickEvent();
	}

	private void clickEvent() {
		batteryButton.setOnClickListener(myListener);
		safelockBtn.setOnClickListener(myListener);
		simBtn.setOnClickListener(myListener);
	}

	private View.OnClickListener myListener = new View.OnClickListener() {

		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.batteryManage:
				intent= new Intent();
				intent.setClass(MainActivity.this, BatteryMainActivity.class);
				startActivity(intent);
				break;
			case R.id.safelockBtn:
				intent = new Intent();
				intent.setClass(MainActivity.this, DialogMainActivity.class);
				startActivity(intent);
				break;
			case R.id.btnSim:
				intent = new Intent(context,SIMMainActivity.class);
				startActivity(intent);
				break;
			}

		}
	};
}
